﻿using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;

namespace corpus_platform.ViewModels
{
    public partial class MainWindowViewModel
    {
        private string informationText = "";
        public string InformationText
        {
            get { return informationText; }
            set { SetProperty(ref informationText, value); }
        }

        private ObservableCollection<ListedFrame> listedFrames = new();
        public ObservableCollection<ListedFrame> ListedFrames
        {
            get { return listedFrames; }
            set { SetProperty(ref listedFrames, value); }
        }

        private ObservableCollection<ListedOntology> listedOntologies = new();
        public ObservableCollection<ListedOntology> ListedOntologies
        {
            get { return listedOntologies; }
            set { SetProperty(ref listedOntologies, value); }
        }

        private ObservableCollection<ListedFrameElement> listedFrameElements = new();
        public ObservableCollection<ListedFrameElement> ListedFrameElements
        {
            get { return listedFrameElements; }
            set { SetProperty(ref listedFrameElements, value); }
        }

        private ListedFrame selectedListedFrame;
        public ListedFrame SelectedListedFrame
        {
            get { return selectedListedFrame; }
            set
            {
                SetProperty(ref selectedListedFrame, value);
                InformationText = value.Information;
                ListedFrameElements.Clear();
                foreach (ListedFrameElement frameElement in value.FrameElements)
                {
                    ListedFrameElements.Add(frameElement);
                }
            }
        }

        private ListedOntology selectedListedOntology;
        public ListedOntology SelectedListedOntology
        {
            get { return selectedListedOntology; }
            set
            {
                SetProperty(ref selectedListedOntology, value);
                InformationText = selectedListedOntology.Information;
            }
        }

        private ListedFrameElement selectedListedFrameElement;
        public ListedFrameElement SelectedListedFrameElement
        {
            get { return selectedListedFrameElement; }
            set
            {
                SetProperty(ref selectedListedFrameElement, value);
                InformationText = value.Information;
            }
        }
    }
}
